//
//  HuanKuanJiluViewController.m
//  wangzhe
//
//  Created by 李 佳伟 on 2018/3/1.
//  Copyright © 2018年 李 佳伟. All rights reserved.
//

#import "HuanKuanJiluViewController.h"
#import "JTCSM.h"
#import "HuankuanJiluTableViewCell.h"

@interface HuanKuanJiluViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong) UITableView *tableview;
@end

@implementation HuanKuanJiluViewController

- (void)gotBack{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)refreshData{
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [df isRemoveTarbar:YES];
    self.navigationController.navigationBar.hidden = NO;
    self.view.backgroundColor =[UIColor whiteColor];
    leftBarButtonItems_rightBarButtonItems *leftbtn = KCUSTOMNAVIGSTION_ALLOC;
    self.navigationItem.leftBarButtonItem = [leftbtn setBarButtonItemsImageName:@"fanhui.png" frame:KLeftBarButtonItemFrame_image target:self SEL:@selector(gotBack)];
    self.navigationItem.rightBarButtonItem = [leftbtn setBarButtonItemsTitle:@"刷新" frame:KRightBarButtonItemFrame_text target:self SEL:@selector(refreshData)];
    [self layoutTbaleview];
    // Do any additional setup after loading the view.
}

- (void)layoutTbaleview{
    self.tableview = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, KCONTROLLERWith, KCONTROLLERHeight) style:UITableViewStylePlain];
    self.tableview.backgroundColor = [UIColor whiteColor];
    self.tableview.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableview.delegate = self;
    self.tableview.dataSource = self;
    [self.view addSubview:self.tableview];
}

- (UIView *)headerviewWithTitle:(NSString *)title{
    
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KCONTROLLERWith, 36)];
    view.backgroundColor = RGBACOLOR(241, 241, 241, 1);
    
    UILabel *label = [UILabel initWithFrame:CGRectMake(20, 0, KCONTROLLERWith-20, 36) text:title font:12 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(51, 51, 51, 1) backgroundColor:nil];
    [view addSubview:label];
    
    return view;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    NSString *cellid = [NSString stringWithFormat:@"cell%ld%ld",indexPath.section,indexPath.row];
    
    HuankuanJiluTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellid];
    if (cell == nil) {
        cell = [[HuankuanJiluTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellid cellType:IsDefulatType];
    }
    [cell setValueWithModel:indexPath];
    return cell;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    return [self headerviewWithTitle:@"2018-03"];
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 36;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 75;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
